<template>
  <el-dialog :title="title" :visible.sync="dialogVisible">
    <div class="Dialog">
      <div class="content">
        <div class="tableList flex">
          <div class="tableList_title">演练单位</div>
          <div class="tableList_con">
            <el-input v-model="List.演练单位" placeholder="请输入演练单位" />
          </div>
          <div class="tableList_title">演练年度</div>
          <div class="tableList_con">
            <el-date-picker v-model="List.演练年度" type="year"  placeholder="选择演练年度" value-format="yyyy" format="yyyy" />
          </div>
        </div>
        <div class="tableList flex">
          <div class="tableList_title">演练月份</div>
          <div class="tableList_con">
            <el-select v-model="List.演练月份" placeholder="选择月份" clearable>
              <el-option v-for="month in 12" :key="month" :label="`${month}月`"
                :value="month < 10 ? `0${month}` : `${month}`" />
            </el-select>
          </div>
          <div class="tableList_title">预案名称</div>
          <div class="tableList_con">
            <el-input placeholder="请输入预案名称" v-model="List.预案名称" clearable />
          </div>
        </div>
        <div class="tableList flex">
          <div class="tableList_title">备注</div>
          <div class="tableList_con">
            <el-input placeholder="请输入备注" v-model="List.备注" clearable />
          </div>
          <div class="tableList_title">演练状态</div>
          <div class="tableList_con">
            <el-select v-model="List.状态" placeholder="请选择演练状态" clearable>
              <el-option v-for="item in whetherList" :key="item.value" :label="item.label" :value="item.value" />
            </el-select>
          </div>
        </div>
        <div class="tableList_1 flex">
          <div class="tableList_title">演练文档</div>
          <div class="tableList_con">
            <el-upload class="upload-demo flex" drag action="https://jsonplaceholder.typicode.com/posts/" multiple
              :auto-upload="false" :on-change="handleFileChange" :on-remove="handleRemove" :file-list="fileList">
              <i class="el-icon-plus"></i>
              <div class="el-upload__text">拖拽文件到这里<br />支持多文件同时上传</div>
            </el-upload>
          </div>
        </div>
      </div>
      <div class="dialog-footer">
        <div class="btns flex">
          <div @click="addEventListener">确定</div>
          <div @click="dialogVisible = false">取消</div>
        </div>
      </div>
    </div>
  </el-dialog>
</template>
<script>
import axios from "axios";
export default {
  props: {
    title: String,
    List: {
      type: Object,
      default: () => ({
        演练单位: "",
        演练年度: "",
        演练月份: "",
        预案名称: "",
        备注: "",
        状态: "",
      })
    }
  },
  data() {
    return {
      dialogVisible: false,
      unitList: [],
      whetherList: [
        { value: '1', label: '已完成' },
        { value: '0', label: '未完成' },
      ],

      fileList: [],
    };
  },
  watch: {
  },
  methods: {
    addEventListener() {
      this.$emit('addEventListener', this.List, this.title)
      this.dialogVisible = false
    },
    handleRemove(file, fileList) {
      this.fileList = fileList;
    },
    handleFileChange(e) {
      const selectedFiles = Array.from(e.target.files);
      this.files = [...this.files, ...selectedFiles];
    },
  },
  mounted() {
  },
};
</script>
<style lang="scss" scoped>
::v-deep .el-dialog {
  width: 1000px;
  height: 610px;
  margin-top: 270px !important;

  .el-dialog__header {
    padding: 7px 16px;
    height: 36px;
    box-shadow: 0px 5px 10px 0px rgba(0, 0, 0, 0.05);

    .el-dialog__title {
      font-family: "Source Han Sans CN";
      font-size: 16px;
      font-weight: 900;
    }

    .el-dialog__headerbtn {
      top: 10px;
    }
  }

  .el-dialog__body {
    padding: 0;
  }

  .Dialog {
    width: 1000px;
    height: 542px;
    font-family: "Source Han Sans CN";
    font-style: normal;

    .flex {
      display: flex;
      justify-content: space-between;
    }

    .content {
      margin: 32px auto;
      width: 920px;
      height: 454px;
      border-top: 2px solid #165DFF;
      border-bottom: 2px solid #165DFF;

      .tableList {
        width: 920px;
        height: 75px;
        border-bottom: 1px solid rgba(22, 93, 255, 0.50);

        .tableList_title {
          width: 126px;
          height: 75px;
          line-height: 75px;
          padding-left: 18px;
          background: rgba(22, 93, 255, 0.05);
        }

        .tableList_con {
          width: 334px;
          padding: 8px 18px;
        }
      }

      .tableList_1 {
        width: 920px;
        height: 227px;

        .tableList_title {
          width: 126px;
          height: 227px;
          line-height: 227px;
          padding-left: 18px;
          background: rgba(22, 93, 255, 0.05);
        }

        .tableList_con {
          width: 794px;
          height: 227px;
          padding: 8px;
        }
      }
    }

    .dialog-footer {
      width: 1000px;
      height: 56px;
      box-shadow: 0px -5px 10px 0px rgba(0, 0, 0, 0.05);
      padding-top: 13px;

      .btns {
        margin-left: 811px;
        width: 124px;
        height: 32px;

        div {
          width: 58px;
          height: 32px;
          line-height: 32px;
          text-align: center;
          border-radius: 4px;

          &:nth-child(1) {
            background: #165DFF;
            box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.04);
            color: #FFF;
            font-size: 14px;
            font-weight: 700;
          }

          &:nth-child(2) {
            border: 1px solid #165DFF;
            color: rgba(22, 93, 255, 0.70);
            font-size: 14px;
            font-weight: 350;
          }

          &:hover {
            cursor: pointer;
          }
        }
      }
    }
  }
}

::v-deep .el-input--medium .el-input__inner {
  height: 58px !important;
  line-height: 58px !important;
  width: 290px !important;
  border: none;
}

::v-deep .el-date-editor.el-input,
.el-date-editor.el-input__inner {
  width: 290px !important;
}

::v-deep .el-upload-dragger {
  width: 315px !important;
  height: 210px !important;
  padding-top: 71px;
  border-radius: 4px;
  border: 1px dashed #165DFF;
  background: rgba(22, 93, 255, 0.02);

  .el-icon-plus {
    color: rgba(22, 93, 255, 0.50);
  }
}

::v-deep .el-upload-dragger .el-upload__text {
  margin-top: 10px;
  color: rgba(22, 93, 255, 0.50);
  text-align: center;
  font-size: 14px;
  font-weight: 400;
  line-height: 22px;
}

::v-deep .el-upload-list {
  width: 440px;
}
</style>
